home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{0DE92B77-C272-11D1-82B4-E5132F8CF155}#8.0#0"; "csstray.ocx"
- Begin VB.Form frmEx3
- Caption = "SysTray Example #3"
- ClientHeight = 2025
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 5265
- Icon = "frmEx3.frx":0000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- ScaleHeight = 2025
- ScaleWidth = 5265
- ShowInTaskbar = 0 'False
- StartUpPosition = 2 'CenterScreen
- Begin VB.CommandButton cmdClose
- Caption = "&Close"
- Height = 375
- Left = 4080
- TabIndex = 0
- Top = 1560
- Width = 1095
- End
- Begin csSysTrayCtl.csSysTray csSysTray1
- Left = 2760
- Top = 1320
- _ExtentX = 2064
- _ExtentY = 1111
- TrayIcon = "frmEx3.frx":0442
- TrayTip = "Click me to see the window again!"
- TrayVisible = 0 'False
- p_RegCode = "frmEx3.frx":0894
- End
- Begin VB.Label Label3
- Caption = "This example application shows just how easy it is to use the SysTray control in your own application."
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 495
- Left = 120
- TabIndex = 2
- Top = 120
- Width = 5055
- End
- Begin VB.Label Label4
- Caption = $"frmEx3.frx":08B4
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 780
- Left = 120
- TabIndex = 1
- Top = 600
- Width = 5055
- End
- Attribute VB_Name = "frmEx3"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- 'Example program for SysTray Control
- '(C) Copyright 1998 Charon Software, All Rights Reserved
- 'You may use or modify this code in any way you see fit.
- 'Charon Software takes no responsibility for what you may
- 'do with this or any modification of this code.
- 'This example shows how easy it is to change the default
- 'minimize behavior to minimize to the system tray instead!
- Private Sub cmdClose_Click()
- 'pretty simple; just unload our form. The system tray
- 'icons will go away automatically!
- Unload Me
- End Sub
- Private Sub csSysTray1_AfterMinimize(hWnd As Long)
- 'the AfterMinimize event occurs after the user clicked
- 'the minimize button on the window. When we "minimize"
- 'to the system tray, we actually just hide the window.
- 'we know we're "zoomed" to the tray, so just show the icon.
- csSysTray1.TrayShow
- End Sub
- 'When the user clicks on the icon, we want to zoom the window
- 'back to its regular spot. However, we don't want the system
- 'tray icon to disappear until the window is fully restored.
- 'If the user were to double-click really fast, they could
- 'launch the zoom animation twice! So, we create a static
- 'variable here to exit the event sub up front if we are
- 'processing inside of it.
- '**************
- Private Sub csSysTray1_Click()
- Static sProcessing As Boolean
- If sProcessing = True Then Exit Sub 'if we're still zooming,
- 'don't do it again!
- sProcessing = True 'okay, we're starting to zoom the window.
- 'if the user clicks on the icon, zoom our form from the
- 'tray and remove the icon!
- csSysTray1.ZoomFromTray Me.hWnd
- csSysTray1.TrayHide
- sProcessing = False 'we're done processing now :)
- End Sub
- Private Sub Form_Load()
- 'the following function will instruct the SysTray control
- 'to "watch" our window. If the user clicks on the minimize
- 'button, the window will be zoomed to the system tray and
- 'hidden instead. We can stop watching the window with the
- 'RemoveMinimizeWatch method.
- csSysTray1.AddMinimizeWatch Me.hWnd
- End Sub
-